package cn.wangqi.personal.util;

import java.io.Serializable;

/**
 * Created by admin on 2017/9/6.
 */
public class Page implements Serializable {
    private static final long serialVersionUID = 8691130975526655325L;
    private int total; //总记录数
    private int currentPage;//当前第几页
    private int pageSize;//每页显示的记录数
    private int start; //查询的开始记录

    private int pageTotal;

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getStart() {
        return start;
    }

    public void setStart(int start) {
        this.start = start;
    }

    public int getPageTotal(){
        if(total > 0){
            if(total % getPageSize() == 0){
                return total / getPageSize();
            }
            else{
                return total/getPageSize() + 1;
            }
        }
        return 0;
    }

    public int getPageNum(){
        if(getTotal() == 0){
            return 0;
        }
        return getTotal()/getPageSize()+1;
    }
}